package com.xl.exercise;

public class Test5 {
    public static void main(String[] args) {
        //完成找素数
        System.out.println("当前素数的个数是："+(isPrime(101,200)));
    }

    public static int isPrime(int start, int end) {
        int num = 0;
        for (int i = start; i <= end; i++) {
            if (i == 1) {
                continue;
            }
            boolean flag = true;
            for (int j = 2; j <= i/2; j++) {
                if (i % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                num++;
                System.out.println(i);
            }
        }
        return num;
    }
}
